<template>
  <div class="list-wrapper">
    <h3>客户推荐学员统计</h3>
    <div style="padding-left:20px">
      <span>客户：</span>
    <span @click="goCustomerDetail" style="cursor: pointer;">{{info.customer}}</span>
    </div>
		<div class="list-top">
      <span>课程名称：{{info.course}}</span>
			<span>开课日期：{{info.startdate}}</span>
		</div>
		<table class="list-table" border="0" cellspacing="0" cellpadding="0">
			<thead>
				<tr>
					<th>序号</th>
					<th>姓名</th>
					<th>身份证号/SIB</th>
          <th>学费</th>
				</tr>
			</thead>
			<tbody>
				<tr v-for="(item,index) in list" @click="goTraineeDetail(item.id)">
					<td>{{index+1}}</td>
					<td>{{item.name?item.name:item.ename}}</td>
					<td>{{item.idcard?item.idcard:sib}}</td>
          <td>{{item.tuition}}</td>
				</tr>
			</tbody>
		</table>
		<div class="pagination">
      <div class="mess" v-if="!list.length">暂无数据</div>
    </div>
	</div>
</template>
<script>
export default {
  data() {
    return {
      trainingid: '',
      payer: '',
      info : {},
      list: []
    };
  },
  created(){
    this.trainingid = this.$route.params.id;
    this.payer = this.$route.params.num;
    this.fetchData();
  },
  methods:{
    fetchData() {
      let data = {
        trainingid: this.trainingid,
        payer: this.payer
      };
      this.apiPost("Dashboard/trainingDetail", data).then(res => {
        this.info = res.info;
        this.list = res.list;
      });
    },
    goCustomerDetail() {
      window.open(SITE+"customer/detail/"+this.info.id);
    },
    goTraineeDetail(id) {
      window.open(SITE+"trainee/detail/"+id);
    }
  }
};
</script>
<style lang="css" scoped>
.container {
  box-sizing: border-box;
  width: 100%;
  background: #ffffff;
  min-height: 100%;
  font-size: 14px;
  overflow: hidden;
}
.list-wrapper > h3 {
  text-align: center;
  padding-top: 20px;
}
.list-top{
  padding: 10px 20px;
}
.pagination {
  text-align: center;
  margin-top: 30px;
}
.mess {
  color: #666;
}
</style>
